<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    class Person {
      constructor(name, age) {
        this.name = name
        this.age = age
      }
      speck () {
        console.log(`我的名字${this.name},我的年纪${this.age}`);

      }
    }
    class Student extends Person {
      constructor(name, age, grade) {
        super(name, age)
        this.grade = grade
      }
      speck () {
        console.log(`我的名字${this.name},我的年纪${this.age}我在读${this.grade}年级`);

      }
      study () {
        console.log('我正在学习');

      }
    }

    // const p1 = new Person('小明', 18)
    // const p2 = new Person('小红', 20)
    // console.log(p1);
    // console.log(p2);
    // p1.speck()
    // p2.speck()
    const s1 = new Student('小白', 12, 6)
    console.log(s1);
    s1.speck()
    s1.study()
  </script>
</body>

</html>